import {Module} from "@nestjs/common";
import {AuthService} from "./AuthService";
import {AuthController} from "./AuthController";
import {SysUserModule} from "../module/SysUserModule";
import {PassportModule} from "@nestjs/passport";
import {JwtModule} from "@nestjs/jwt";
import {JwtConstant} from "../common/constant/JwtConstant";
import {JwtStrategy} from "./strategy/JwtStrategy";
import {JwtAuthGuardProvider, RoleGuardProvider} from "./guard/GlobalGuardProvider";

@Module({
    imports: [
        SysUserModule,
        PassportModule,
        JwtModule.register({
            secret: JwtConstant.secretKey,
            signOptions: {
                expiresIn: JwtConstant.expiresIn
            }
        })
    ],
    controllers: [AuthController],
    providers: [
        AuthService,
        JwtStrategy,
        JwtAuthGuardProvider,
        RoleGuardProvider
    ],
    exports: [AuthService]
})
export class AuthModule{}
